/**
 * 
 */
package smallChanges.statements;

import smallChanges.Tokenization.TokenSet;

/**
 * @author jspacco
 *
 */
public class ForStatementHeader extends StatementHeader
{
	private MetaInformationAnnotation forInit;
	private MetaInformationAnnotation condition;
    private MetaInformationAnnotation forUpdate;
	
	public ForStatementHeader(TokenSet tokenSet) {
		super(tokenSet);
		setStmtType(FOR_LOOP_HEADER);
	}
    
    //public String getCoords() {
        
//        return "init: " +toStringOrEmpty(forInit) +
//        ", cond: " +toStringOrEmpty(condition)+
//        ", update: "+toStringOrEmpty(forUpdate);
    //}
    
	public String getImage()
	{
	    // TODO we're getting the whole damn method
	    return getTokenImage();
//        String result="for (";
//        result += (forInit != null)?" "+forInit.getTokenImage()+" ; ":" ; ";
//        result += (condition!= null)?condition.getTokenImage()+" ;":";";
//        result += (forUpdate!= null)?" "+forUpdate.getTokenImage():"";
//        result += " ) ";
//        return result;
	}



    @Override
    String toStringHelper(int depth)
    {
        // TODO show the actual tokens!
        return getImage();
//        String result="for (";
//        result += (forInit != null)?" "+forInit.getCoords()+" ; ":" ; ";
//        result += (condition!= null)?condition.getCoords()+" ;":";";
//        result += (forUpdate!= null)?" "+forUpdate.getCoords():"";
//        result += " ) ";
//        return result;
    }

    /**
	 * @return the forInit
	 */
	public MultiTokenCodeRange2D getForInit()
	{
		return forInit;
	}

	/**
	 * @param forInit the forInit to set
	 */
	public void setForInit(MetaInformationAnnotation forInit)
	{
		this.forInit = forInit;
		addMetaInfo(forInit);
	}

	/**
	 * @return the forUpdate
	 */
	public MetaInformationAnnotation getForUpdate()
	{
		return forUpdate;
	}

	/**
	 * @param forUpdate the forUpdate to set
	 */
	public void setForUpdate(MetaInformationAnnotation forUpdate)
	{
		this.forUpdate = forUpdate;
		addMetaInfo(forUpdate);
	}

	/**
	 * @return the condition
	 */
	public MetaInformationAnnotation getCondition()
	{
		return condition;
	}

	/**
	 * @param condition the condition to set
	 */
	public void setCondition(MetaInformationAnnotation condition)
	{
		this.condition = condition;
		addMetaInfo(condition);
	}
}
